// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import 'lib-flexible/flexible.js'//移动端适配代码
import mui from '../static/mui.min.js'
import './assets/js/jquery-vendor'
import $ from 'jquery' //在需要使用的页面中
Vue.prototype.$http= axios;
import global_msg from './assets/js/global.js'
import maps from "./assets/js/Maps.js"
import yy from "./assets/js/yy_vue.js"
import zoom from "./assets/js/zoom.js"
Vue.prototype.$zoom = zoom
Vue.prototype.mui = mui;
Vue.prototype.$yy = yy
Vue.prototype.$global_msg = global_msg;
Vue.prototype.$maps = maps;
import terminal from "./assets/js/terminal.js"
Vue.prototype.$terminal = terminal
import './assets/css/reset.css' //引入全局样式
import {Button,Grid,GridItem,Tabbar,TabbarItem,Overlay,Toast,Popup,Checkbox,CheckboxGroup,List,Tab,Tabs} from 'vant'

Vue.use(Button).use(Grid).use(GridItem).use(Tabbar).use(TabbarItem).use(Overlay).use(Toast).use(Popup).use(Checkbox).use(CheckboxGroup).use(List).use(Tab).use(Tabs);
Vue.config.productionTip = false


import { NavBar,Progress,Icon,Field,Cell, CellGroup,RadioGroup, Radio,Divider,Dialog,SwipeCell   } from 'vant';

Vue.use(NavBar).use(Icon).use(Progress).use(Field).use(Cell).use(CellGroup).use(Radio).use(RadioGroup).use(Divider).use(Dialog).use(SwipeCell);

//allen添加的vant样式
import { Collapse, CollapseItem,Tag} from 'vant';
Vue.use(Collapse).use(CollapseItem).use(Tag);

import { PullRefresh } from 'vant';
Vue.use(PullRefresh);

import { DatetimePicker,Picker} from 'vant';
Vue.use(DatetimePicker).use(Picker);

//弹出框禁止滑动
Vue.prototype.noScroll = function () {
  var mo = function (e) { e.preventDefault() }
  document.body.style.overflow = 'hidden'
  document.addEventListener('touchmove', mo, false)// 禁止页面滑动
}

//弹出框可以滑动
Vue.prototype.canScroll = function () {
  var mo = function (e) {
    e.preventDefault()
  }
  document.body.style.overflow = ''// 出现滚动条
  document.removeEventListener('touchmove', mo, false)
}

import axios from "axios"
// 每次请求携带cookies信息
axios.defaults.withCredentials = false
axios.defaults.timeout = 30000;
Vue.prototype.axios = axios
//配置请求根路径
//axios.defaults.baseURL = 'http://cqyjaq.menphis.cn:8015'//正式
//axios.defaults.baseURL = 'http://219.153.71.175:8015/yzsafe-login-app'//测试
axios.defaults.baseURL = 'http://183.66.102.101:8015/yzsafe-login-app'//测试
/* eslint-disable no-new */
import qs from 'qs';
Vue.prototype.qs = qs
import Router from 'vue-router'
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}

Vue.filter('datatime', function (datastr) {
  var dt = new Date(datastr);
  var y = dt.getFullYear();
  var m = (dt.getMonth() + 1).toString().padStart(2, '0');
  var d = dt.getDate().toString().padStart(2, '0');
  var h = dt.getHours().toString().padStart(2, '0');
  var f = dt.getMinutes().toString().padStart(2, '0');
  var k = dt.getSeconds().toString().padStart(2, '0');

  return `${y}-${m}-${d} ${h}:${f}:${k}`

})
Vue.filter('qiegei', function (val) {
  return val.slice(0,2)

})
Vue.filter('qiegei_tongji', function (val) {

  if(val.length>5){
    return val.slice(0,5)+"..."
  }else{
    return val
  }

})

new Vue({
  el: '#app',
  router,
  components: {
    App
  },
  template: '<App/>'
})
